package com.CityHunter.Request;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;

import android.util.Log;

import com.CityHunter.Common.Http;

public class DeleteBuddyRequest {
	
	private String deleteBuddyPage;
	
	public DeleteBuddyRequest(String deleteBuddyPage){
		this.deleteBuddyPage = deleteBuddyPage;
	}
	
	public int deleteBuddy(int userid, int buddyid){
		
		int result = 0;
		
		// Declare NameValuePair to store the data
		List<NameValuePair> params = new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair("userid", Integer
				.toString(userid)));
		params.add(new BasicNameValuePair("buddyid", Integer
				.toString(buddyid)));

		// Send Get Buddy ID Request
		Http http = new Http();
		Log.d("bdyp_Debug", "Sending Request : " + deleteBuddyPage);
		JSONArray jsonResponse = http.sendRequest(deleteBuddyPage, params);
		try {
			result = Integer.parseInt(jsonResponse.getJSONObject(0)
					.getString("result"));
			Log.d("bdyp_Debug", "Response Result : " + result);
		} catch (Exception e) {
			Log.e("bdyp_Error", e.getMessage().toString());
		}
		
		return result;
	}
	
}
